package loppy.dynamics 
{
  import loppy.loppy_internal;
  
	public class CircleShape extends Shape
  {
    use namespace loppy_internal;
    
    loppy_internal var radius:Number;
    
    public function CircleShape(radius:Number, config:ShapeConfig = null) 
    {
      super(CIRCLE, (config)?(config):(new ShapeConfig()));
      
      this.radius = radius;
    }
    
    override internal function updateMass():void 
    {
      mass           = Math.PI * radius * radius;
      inverseMass    = 1.0 / mass;
      intertia       = 0.5 * mass * radius * radius;
      inverseInertia = 1.0 / intertia;
    }
    
    override internal function updateProxy():void 
    {
      proxy.minX = globalPosition.x - radius;
      proxy.minY = globalPosition.y - radius;
      proxy.maxX = globalPosition.x + radius;
      proxy.maxY = globalPosition.y + radius;
    }
  }
}
